<template>
  <div class="subpoena-container">
    <div>
      <div>期末考试  试卷/答题卷</div>
      <div>请仔细核对试卷、答题卷页数并正确填写</div>
      <ul>
        <li>
          <div>学期</div>
          <div>{{ tablelist.termname }}</div>
        </li>
        <li>
          <div>考试科目</div>
          <div>{{tablelist.coursename  }}</div>
        </li>
        <li>
          <div>年级</div>
          <div>{{ tablelist.gradename }}</div>
        </li>
        <li>
          <div>专业</div>
          <div>{{ tablelist.specialty }}</div>
          
        </li>
        <li>
          <div>份数</div>
          <div class="edit-box paper-description">
            <span>共<el-input style="width: 80px" size="small" v-model="tablelist.gjd"></el-input>袋</span>
            <span>第<el-input style="width: 80px" size="small" v-model="tablelist.djd"></el-input>袋</span>
            <span><el-input style="width: 80px" size="small" v-model="tablelist.dsf"></el-input>份</span>
          </div>
        </li>
        <li>
          <div>教学单位</div>
          <div class="edit-box">
            <el-input v-model="tablelist.jxdw" size="small" style="width: 204px"></el-input>
          </div>
        </li>
        <li>
          <div>任课教员</div>
          <div>{{ tablelist.teacher }}</div>
        </li>
        <li>
          <div>考试情况</div>
          <div class="edit-box paper-description">
            <span>应考<el-input style="width: 80px" size="small" v-model="tablelist.ykdsr"></el-input>人</span>
            <span>实考<el-input style="width: 80px" size="small" v-model="tablelist.skdsr"></el-input>人</span>
            <span>缺考<el-input style="width: 80px" size="small" v-model="tablelist.qkdsr"></el-input>人</span>
          </div>
        </li>
      </ul>
      <div class="button-group">
        <div @click="sasgetSubmit">保存</div>
        <div @click="Submit">取消</div>
      </div>
    </div>
    <el-dialog
      title="提示"
      :visible.sync="showTipDialog"
      width="983px"
      class="paper-message-container"
    >
      <div class="paper-message-text">
        <div>
          您的试卷材料、试卷袋封皮、送印传票要素不齐全，确定要提交吗？
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <button class="confirm-button" @click="showTipDialogClick('true')">
          确 定
        </button>
        <button class="cancle-button" @click="showTipDialogClick('false')">
          取 消
        </button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { SelectById,sasgetSubmit } from "@/api/propositionReview/subpoena";

export default {
  name: "subpoena",
  data() {
    return {
      value1: new Date(),
      description: ' ',
      showTipDialog: false,
      pid:"",
      tablelist: {
        "id": '',
        "subject": "",
        "grade": "",
        "major": "",
        "paperpage": "",
        "keypage": "",
        "numbers": "",
        "sendtime": new Date(),
        "awaytime": new Date(),
        "comments": ""
      },
    }
  },
  mounted() {
    this.pid = this.$route.query.id;
    let obj = {
      id:this.$route.query.id
    }
    this.SelectById(obj);
  },
  methods: {
    showTipDialogClick(type) {
      if (type === 'true') {
        this.showTipDialog = true
      } else {
        this.showTipDialog = false
      }

      this.sasgetSubmit()
    },
    // submit(type) {
    //   if (type === 'true') {
    //     if (this.tablelist.paperpage && this.tablelist.keypage && this.tablelist.numbers && this.tablelist.comments) {
    //       this.sasgetSubmit()
    //     } else {
    //       this.showTipDialog = true
    //     }
    //   } else {
    //     this.$router.push({
    //       path: '/teacher/propositionReview/approval',
    //     })
    //   }


    // },
    sasgetSubmit() {
    
      this.tablelist.testpapperandprintid= this.pid
      console.log(this.tablelist)
      let obj = this.tablelist
      let el = this
      return new Promise(() => {
        sasgetSubmit(obj).then(res => {
         console.log("78787878")
            this.$router.push({
              path: '/admin/propositionReview/approval',
            })
            
        })
      })
    },
    Submit() {
      this.$router.push({
              path: '/admin/propositionReview/approval',
            })
    },
    SelectById(obj) {

      let el = this
      return new Promise(() => {
        SelectById(obj).then(res => {
          this.tablelist = res.data.data
           console.log(res.data.data)
        })
      })
    },
  }
};
</script>
<style lang="less">
.subpoena-container {
  .el-input--small .el-input__inner {
    font-size: 14px;
  }

  .el-dialog__footer {
    padding-bottom: 125px;
  }
}
</style>
<style scoped lang="less">
.subpoena-container {
  > div {
    > div {
      width: 915px;

      &:nth-child(1) {
        margin: 42px auto 44px;
        font-size: 20px;
        font-weight: bold;
        line-height: 20px;
        color: #004CA7;
        text-align: center;
      }

      &:nth-child(2) {
        font-size: 16px;
        font-weight: bold;
        line-height: 30px;
        color: #004CA7;
        margin: 0 auto 22px;
      }
    }

    > ul {
      width: 916px;
      height: 680px;
      border: 1px solid #004CA7;
      margin: 0 auto 46px;
      list-style: none;

      > li {
        border-bottom: 1px solid rgba(0, 76, 167, 0.39);

        &:last-child {
          border-bottom: none;
        }

        > div {
          display: inline-block;
          height: 84px;
          vertical-align: middle;

          &:nth-child(1) {
            width: 289px;
            background: rgba(77, 129, 192, 0.1);
            padding: 32px 0 0 114px;
            font-size: 16px;
            font-weight: bold;
            color: #004CA7;
          }

          &:nth-child(2) {
            padding: 33px 0 0 95px;
            font-size: 14px;
            color: #004CA7;
          }
        }

        .edit-box {
          padding-top: 25px !important;
          font-size: 14px;
        }

        .paper-description {
          > span {
            .el-input--small {
              margin: 0 10px;
            }

            &:nth-child(1) {
              margin-right: 40px;
            }
          }
        }
      }
    }

    //.btnNumber{
    //  /deep/ .el-input__inner{
    //    width: 54px;
    //  }
    //}
    .button-group {
      width: 915px;
      margin: 0 auto;
      text-align: center;

      > div {
        display: inline-block;
        font-size: 18px;
        padding: 6px 22px;
        border-radius: 6px;
        cursor: pointer;

        &:nth-child(1) {
          color: #F3B815;
          border: 1px solid #F3B815;
          background: #FFF6EF;
          margin-right: 139px;
        }

        &:nth-child(2) {
          color: rgba(250, 83, 57, 1);
          border: 1px solid rgba(250, 83, 57, 1);
          background: rgba(255, 239, 239, 1);
        }
      }
    }
  }

  .paper-message-container {
    .paper-message-text {
      > div {
        padding: 57px 0 63px 0;
        font-size: 18px;
        font-family: Microsoft YaHei;
        font-weight: bold;
        line-height: 20px;
        color: #004ca7;
        text-align: center;
      }
    }

    .el-dialog__footer {
      padding-bottom: 95px;
    }

    .confirm-button {
      width: 87px;
      height: 36px;
      padding: 0;
      background: #f1fff8;
      border: 1px solid #02c86c;
      border-radius: 4px;
      font-size: 18px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #02c86c;
      cursor: pointer;
      margin-right: 92px;
    }

    .cancle-button {
      .confirm-button;
      background: #fff6ef;
      border: 1px solid #f3b815;
      color: #f3b815;
      margin-right: 0px;
    }
  }
}
</style>
